/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cart;

import model.Product;

/**
 *
 * @author Thai Ha Cong
 */
public class ShoppingCartItem {
    private int quantity;
    private double price;
    private Product product;

    public ShoppingCartItem() {
    }

    public ShoppingCartItem(Product product) {
        this.product = product;
    }

    public ShoppingCartItem(int quantity, double price, Product product) {
        this.quantity = quantity;
        this.price = price;
        this.product = product;
    }

    public int getQuantity() {
        return quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 13 * hash + (this.product != null ? this.product.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ShoppingCartItem other = (ShoppingCartItem) obj;
        if (this.product != other.product && (this.product == null || !this.product.equals(other.product))) {
            return false;
        }
        return true;
    }
}
